package ar.edu.unq.leezsi.core;

import ar.edu.unq.leezsi.continuation.ContinuationContext;
import ar.edu.unq.leezsi.requestcycle.RequestCycle;

public class Context {
	private final Session session;
	private boolean isCookie;
	private final String id;
	private final RequestCycle requestCycle = new RequestCycle(this);
	private final ContinuationContext continuationContext = new ContinuationContext();
	private final URLMapper urlMapper;

	public Context(String id, URLMapper urlMapper) {
		this.id = id;
		this.session = new Session(id);
		this.urlMapper = urlMapper;
	}

	public void fromCookie(boolean isCookie) {
		this.isCookie = isCookie;
	}

	public String getContextURI() {
		return this.getRequestCycle().getContextURI();

	}

	public ContinuationContext getContinuationContext() {
		return this.continuationContext;
	}

	public String getId() {
		return this.id;
	}

	public RequestCycle getRequestCycle() {
		return this.requestCycle;
	}

	public Session getSession() {
		return this.session;
	}

	public URLMapper getUrlMapper() {
		return this.urlMapper;
	}

	public boolean isCookie() {
		return this.isCookie;
	}

}
